package keeto.com.vn.bms.ui.adapter;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import keeto.com.vn.bms.ui.activity.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

public class ListFileSDCardAdapter extends BaseAdapter {
	private Context mContext;
	private ArrayList<File> mArrayList;
	private LayoutInflater mInflater;
	

	public ListFileSDCardAdapter(Context context, ArrayList<File> list) {
		super();
		this.mContext = context;
		this.mArrayList = list;
		this.mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mArrayList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mArrayList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View v = convertView;
		ViewHolder holder;
		if (v == null) {
			v = mInflater.inflate(R.layout.item_list_file, parent, false);
			holder = new ViewHolder();
			holder.tvFileName = (TextView) v.findViewById(R.id.tv_file_name);
			holder.tvFileTime = (TextView) v.findViewById(R.id.tv_file_time);
			v.setTag(holder);
		}else{
			holder = (ViewHolder) v.getTag();
		}
		holder.tvFileName.setText(mArrayList.get(position).getName());
//		holder.tvFileTime.setText(mArrayList.get(position).getTotalSpace()+"");

		return v;
	}
	class ViewHolder {
		private TextView tvFileTime;
		private TextView tvFileName;
	}
	
}
